﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CMN.Entity;
using CMN.Common;
using CMN.Framework;
using CMN.BLL;
namespace CMN.UI
{
    /// <summary>
    /// 标签解析
    /// </summary>
    public class DownPageShowDisplay
    {
        static DownPageShowDisplay()
        {
            BaseTemplateDisplay.OnNVelocityLoadPath += new EventHandler<TemplateArg>(downLoadPath);
            BaseTemplateDisplay.OnOtherPageDisplay += new EventHandler<TemplateDisplayArg>(downDisplay);
        }

        /// <summary>
        /// 绑定模板
        /// </summary>
        /// <param name="o"></param>
        /// <param name="arg"></param>
        private static void downDisplay(object o, TemplateDisplayArg arg)
        {
            if (arg.PageHelper.OtherTypeName == "down")
            {
                Module_Article bllArticle = new Module_Article();
                Module_ArticleEntity article = bllArticle.DispRemark(arg.PageHelper.ContentId);
                arg.PageHelper.Title = string.Concat(article.Title, "下载页面");
               // article.Remark = string.Concat("<scritp>", article.Remark, "</script>");
                if (article == null)
                    article = new Module_ArticleEntity();
                arg.NvelocityTemplate.Put("article", article);
            }
        }

        /// <summary>
        /// 加载模板路径
        /// </summary>
        /// <param name="o"></param>
        /// <param name="arg"></param>
        private static void downLoadPath(object o, TemplateArg arg)
        {
            if (arg.PageHelper.OtherTypeName == "down")
            {
                arg.TemplateEntity = MvcWebCacheManager.GetDefaultTemlateEntity();
                arg.TemplateEntity.TemplateName = "down.htm";
            }

        }

    }

}
